001    package jgb.examples.eventhandlers;
002    
003    
004    import jgb.builder.TagHandler;
005    
006    import javax.swing.*;
007    import java.util.EventObject;
008    import java.util.Map;
009    
010    /**
011     * @author Francois Beausoleil, <a href="mailto:fbos@users.sourceforge.net">fbos@users.sourceforge.net</a>
012     */
013    public class ListClearer {
014        private String modelId;
015    
016        public ListClearer(String modelId) {
017            this.modelId = modelId;
018        }
019    
020        public void handleEvent(Map context, EventObject eventObject) {
021            Map objectsMap = (Map)context.get(TagHandler.OBJECTS_MAP_KEY);
022            DefaultListModel model = (DefaultListModel)objectsMap.get(modelId);
023            model.clear();
024        }
025    }